package hc.bre.data.strategy

import hc.bre.clas.ClasResultStruct
import hc.bre.cmn.struct.DataStructItem
import hc.bre.cmn.struct.OptionDataStruct

@groovy.transform.CompileStatic
@groovy.transform.ToString(includeNames=true,includePackage=false)
class StrategyStruct extends OptionDataStruct {
	StrategyStruct() {
		DataStructItem item;
		item = new DataStructItem();
		item.id = ++maxid;
		item.code = 'valueMap';
		item.name = '用户定义数据';
		item.type = 'object';
		item.important = 30
		//further definition from the rule definition
		item.list = [];
		root.list.add(item);
	}

	StrategyStruct(StrategyDefinition ruleDef)
	{
		this();

		fillUserDef(ruleDef);
	}

	StrategyStruct fillUserDef(StrategyDefinition ruleDef)
	{
		def data = root.list.last();

		ruleDef.valueDefList.each {
			data.list.add(it.toStructItem());
		};

		return this;
	}

}
